package org.example.dormsystem.controller;

import org.example.dormsystem.pojo.Result;
import org.example.dormsystem.pojo.Student;
import org.example.dormsystem.service.DormitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/dormitory")
public class DormitoryController {

    @Autowired
    DormitoryService dormitoryService;

    @GetMapping("/searchStudentByRoomNumber")
    Result searchStudent(String RoomNumber){
        List<Student> list = dormitoryService.searchStudent(RoomNumber);
        return Result.success(list);
    }

}
